package net.oschina.bilbodai.common.beanutil.property.asm.lexer.code.mp;

import java.util.List;
import java.util.Map;

/**
 * @author daimao  Date: 16/4/22 Time: 下午5:19
 * @version $Id$
 */
public enum MapValueType {
    object {
        @Override
        public Class<?> type(String type) {
            return Object.class;
        }
    },
    list {
        @Override
        public Class<?> type(String type) {
            return List.class;
        }
    },
    map {
        @Override
        public Class<?> type(String type) {
            return Map.class;
        }
    },
    barray {
        @Override
        public Class<?> type(String type) {
            return byte[].class;
        }
    },
    Barray{
        @Override
        public Class<?> type(String type) {
            return Byte[].class;
        }
    },
    sarray{
        @Override
        public Class<?> type(String type) {
            return short[].class;
        }
    },
    Sarray{
        @Override
        public Class<?> type(String type) {
            return Short[].class;
        }
    },
    iarray{
        @Override
        public Class<?> type(String type) {
            return int[].class;
        }
    },
    Iarray{
        @Override
        public Class<?> type(String type) {
            return Integer[].class;
        }
    },
    larray{
        @Override
        public Class<?> type(String type) {
            return long[].class;
        }
    },
    Larray{
        @Override
        public Class<?> type(String type) {
            return Long[].class;
        }
    },
    farray{
        @Override
        public Class<?> type(String type) {
            return float[].class;
        }
    },
    Farray{
        @Override
        public Class<?> type(String type) {
            return Float[].class;
        }
    },
    darray{
        @Override
        public Class<?> type(String type) {
            return double[].class;
        }
    },
    Darray{
        @Override
        public Class<?> type(String type) {
            return Double[].class;
        }
    },
    lookup {
        @Override
        public Class<?> type(String type) {
            String className = type.replace("/", ".");
            try {
                return Class.forName(className);
            } catch (ClassNotFoundException e) {
                throw new IllegalStateException("Class Not Found for: " + className, e);
            }
        }
    };

    public abstract Class<?> type(String type);
}